<?php

namespace app\common\model;

use app\common\enum\DeviceEnum;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;

/**
 * 设备模型
 * Class Device
 * @package app\common\model\room
 */
class Device extends BaseModel
{
    use SoftDelete;

    protected $deleteTime = 'delete_time';

    protected $append = ['device_type','campus_text'];

    public function getDeviceTypeAttr($value,$data){
        return DeviceEnum::getDisableDesc($data['type']);
    }

    public function getCampusTextAttr($value,$data){
        $campus = Campus::where('id',$data['cid'])->value('name');
        return $campus;
    }



}